<?php defined('_JEXEC') or die('Restricted access'); ?>
<?php JHTML::_('behavior.tooltip'); ?>
<?php
	// Set toolbar items for the page
	$edit		= JRequest::getVar('edit',true);
	$text = !$edit ? JText::_( 'New' ) : JText::_( 'Edit' );
	JToolBarHelper::title(   JText::_( strtoupper('order') ).': <small><small>[ ' . $text.' ]</small></small>' );
	JToolBarHelper::save();
	if (!$edit)  {
		JToolBarHelper::cancel();
	} else {
		// for existing items the button is renamed `close`
		JToolBarHelper::cancel( 'cancel', 'Close' );
	}
?>
<script language="javascript" src="<?php echo $this->lists['comdir']; ?>mwc_order.js"></script>
<script language="javascript" type="text/javascript">
	function submitbutton(pressbutton) {
		var form = document.adminForm;
		if (pressbutton == 'cancel') {
			submitform( pressbutton );
			return;
		}
		
		/*if (form.catid.value == 0)
		{
			alert('<?php echo JText::_( 'Please select a order' ); ?>');
			return;
		}*/

		// do field validation
		submitform( pressbutton );
	}
</script>
<form action="<?php echo $this->action; ?>" method="post" name="adminForm" id="adminForm">
<div class="col width-70">
	<fieldset class="adminform">
		<legend><?php echo JText::_( 'Details' ); ?></legend>
  <table class="admintable">
    <tr>
      <td width="100" align="right" class="key"><label for="<?php echo $this->prefix; ?>server_name"> <?php echo JText::_( strtoupper('Server Name') ); ?>: </label>
      </td>
      <td><input class="text_area" type="hidden" name="<?php echo $this->prefix; ?>server_id" id="<?php echo $this->prefix; ?>server_id" size="32" maxlength="250" value="<?php echo $this->mwc_order->server_id;?>" />
      <?php echo $this->mwc_order->server_name;?>
      </td>
    </tr>	
    <tr>
      <td width="100" align="right" class="key"><label for="<?php echo $this->prefix; ?>term_id"> <?php echo JText::_( strtoupper('Term') ); ?>: </label>
      </td>
      <td><input class="text_area" type="hidden" name="<?php echo $this->prefix; ?>term_id" id="<?php echo $this->prefix; ?>term_id" size="32" maxlength="250" value="<?php echo $this->mwc_order->term_id;?>" />      
      <?php
      	if ($this->mwc_order->term_id == 1)
      		echo "1 Month (Month to Month)"; 
      	else if ($this->mwc_order->term_id == 3)
      		echo "3 Month Prepay - 5% discount"; 
      	else if ($this->mwc_order->term_id == 6)
      		echo "6 Month Prepay - 10% discount"; 
      	else 
      		echo "12 Month Prepay - 15% discount";
      ?>     
      </td>
    </tr>	
    <tr>
      <td width="100" align="right" class="key"><label for="<?php echo $this->prefix; ?>location_name"> <?php echo JText::_( strtoupper('Location') ); ?>: </label>
      </td>
      <td><input class="text_area" type="hidden" name="<?php echo $this->prefix; ?>location_name" id="<?php echo $this->prefix; ?>location_name" size="32" maxlength="250" value="<?php echo $this->mwc_order->location_name;?>" />
      <?php echo $this->mwc_order->location_name;?>
      </td>
    </tr>	
    <tr>
      <td width="100" align="right" class="key"><label for="<?php echo $this->prefix; ?>total_price"> <?php echo JText::_( strtoupper('Total price') ); ?>: </label>
      </td>
      <td><input class="text_area" type="hidden" name="<?php echo $this->prefix; ?>total_price" id="<?php echo $this->prefix; ?>total_price" size="32" maxlength="250" value="<?php echo $this->mwc_order->total_price;?>" />
      <?php echo "$".$this->mwc_order->total_price;?>
      </td>
    </tr>	
    <tr>
      <td width="100" align="right" class="key"><label for="<?php echo $this->prefix; ?>coupon_value"> <?php echo JText::_( strtoupper('Coupon Value') ); ?>: </label>
      </td>
      <td><input class="text_area" type="hidden" name="<?php echo $this->prefix; ?>coupon_value" id="<?php echo $this->prefix; ?>coupon_value" size="32" maxlength="250" value="<?php echo $this->mwc_order->coupon_value;?>" />
      <?php echo "$".$this->mwc_order->coupon_value;?>
      </td>
    </tr>	
    <tr>
      <td width="100" align="right" class="key"><label for="<?php echo $this->prefix; ?>order_price"> <?php echo JText::_( strtoupper('Order Price') ); ?>: </label>
      </td>
      <td>
      	<?php echo "$".($this->mwc_order->total_price - $this->mwc_order->coupon_value) ?>
      </td>
    </tr>	
    <tr>
      <td width="100" align="right" class="key"><label for="<?php echo $this->prefix; ?>first_name"> <?php echo JText::_( strtoupper('Customer Information') ); ?>: </label>
      </td>
      <td><input class="text_area" type="hidden" name="<?php echo $this->prefix; ?>customer_id" id="<?php echo $this->prefix; ?>customer_id" size="32" maxlength="250" value="<?php echo $this->mwc_order->customer_id;?>" />
      Name: <?php echo $this->mwc_order->first_name." ".$this->mwc_order->last_name;?> <br></br>
      Email: <?php echo $this->mwc_order->email;?><br></br>
      Address: <?php echo $this->mwc_order->address;?>
      </td>
    </tr>	
    <tr>
      <td width="100" align="right" class="key"><label for="<?php echo $this->prefix; ?>payment_method_id"> <?php echo JText::_( strtoupper('Payment Method') ); ?>: </label>
      </td>
      <td><input class="text_area" type="hidden" name="<?php echo $this->prefix; ?>payment_method_id" id="<?php echo $this->prefix; ?>playment_method_id" size="32" maxlength="250" value="<?php echo $this->mwc_order->payment_method_id;?>" />
      Name on card: <?php echo $this->mwc_order->name_on_card;?> <br></br>
      Credit card number: <?php echo $this->mwc_order->credit_card_number;?><br></br>
      Card security code: <?php echo $this->mwc_order->card_security_code;?><br></br>
      Expiration: <?php echo $this->mwc_order->expiration;?>
      </td>
    </tr>
   <tr>
      <td valign="top" align="right" class="key"><?php echo JText::_( strtoupper('Status') ); ?>: </td>
      <td><?php echo $this->lists['status']; ?> </td>
    </tr>       
    <tr>
      <td valign="top" align="right" class="key"><label for="<?php echo $this->prefix; ?>order_date"> <?php echo JText::_( strtoupper('order_date') ); ?>: </label>
      </td>
      <td colspan="2" valign="middle"><?php echo JHTML::_('calendar', $this->lists['order_date'], $this->prefix.'order_date', $this->prefix.'order_date', "%Y-%m-%d", array('class'=>'inputbox', 'size'=>'32',  'maxlength'=>'45')); ?> </td>
    </tr> 
  </table>
</fieldset>
</div>
<div class="col width-30">
	<?php
			echo $this->pane->startPane("params-pane");
			$title = JText::_( strtoupper('Parameters') );
			echo $this->pane->startPanel( $title, "detail-page" );
			echo $this->params->render('params');
		?>
	
		
	<?php
				echo $this->pane->endPanel();
				echo $this->pane->endPane();
		?>	
</div>   
  <div class="clr"></div>
  <input type="hidden" name="option" value="com_mwc_order" />
  <input type="hidden" name="cid[]" value="<?php echo $this->mwc_order->order_id; ?>" />
  <input type="hidden" name="task" value="" />
  <input type="hidden" name="user_id" value="<?php echo $this->mwc_order->user_id; ?>"/>
  <?php echo JHTML::_( 'form.token' ); ?>
</form>
